<?php
	//实例化控制器
	//
	//
	function C($name,$method){
		require_once('libs/Controller/'.$name.'Controller.class.php');

		//$testController = new testController();
		//$testController->show();
		//增加灵活性
		//简单但不安全
		eval('$obj = new '.$name.'Controller();$obj->'.$method.'();');

		//代替
		//controller = $name.'controller';
		//obj = new $controller();
		//obj -> $method();
	}



	//实例化模型
	function M($name){
		require_once('libs/Model/'.$name.'Model.class.php');
		eval('$obj = new '.$name.'Model();');
		return $obj;
	}


	//实例化视图
	function V($name){
		require_once('libs/View/'.$name.'View.class.php');
		eval('$obj = new '.$name.'View();');
		return $obj;
	}

	//过滤非法参数：对特殊符号进行转义
	function daddslashes($str){
		return (!get_magic_quotes_gpc())?addslashes($str):$str;
	}



	//第三方类库
	function ORG($path,$name,$params=array()){
		require_once('libs/ORG/'.$path.$name.'.class.php');
		//eval('$obj = new'.$name.'();');
		$obj = new $name();
		if(!empty($params)){
			foreach($params as $key=>$value){
				//eval('$obj->'.$key.' = \''.$value.'\';');
				$obj->$key = $value;
			}
		}
		return $obj;
	}

 ?>